public class TimeConvert
{
   /**
      Converts military time to ordinary time.
      @param milTime, the military time provided: hhmm
      @return a string of the form 9:35 am or 7 pm
   */
   public static String militaryToOrdinaryTime(int milTime)
   {
      int minutes = milTime % 100;
      int hours = milTime / 100;
      String time;
      if(hours >= 12)
      {
         time = "pm";
      } else
      {
         time = "am";
      }
      if(hours == 0)
      {
         hours = 12;
      }
      if(hours > 12)
      {
         hours -= 12;
      }
      if( minutes != 0)
      {
         return hours + ":" + String.format( "%02d", minutes) + " " + time;
      } 
      return hours + " " + time;
   }
}